#ifndef HASHSECONDOPERANDSUBTRACTIONBOX_H_JM_20130206
#define HASHSECONDOPERANDSUBTRACTIONBOX_H_JM_20130206
/// @file HashSecondOperandSubtractionBox.h
/// Logika operacie rozdielu R\S, kde je zahashovana relacia S.

#include "HashActivityBufferedOutputBox.h"
#include "HashActivityHandlerImpls.h"

namespace jm4bbx {

	/**
	 * Logika operacie rozdielu R\S, kde je zahashovana relacia S.
	 **/
	template<class HashBoxType>
	class  HashSecondOperandSubtractionBox 
		: public HashActivityBufferedOutputBox<HashBoxType,
			HashSecondOperandSubtractionHandler<HashBoxType>> {		
	public:
		typedef HashSecondOperandSubtractionHandler<HashBoxType>* SecSubHandlerPtrType;

		HashSecondOperandSubtractionBox(const BoxParamPack& p) 
			: HashActivityBufferedOutputBox(p)	{

				SecSubHandlerPtrType handler = 
					dynamic_cast<SecSubHandlerPtrType>(getHashActivityHandler());
				
				assert(handler != nullptr);

				handler->setHashTable(HashBoxType::HTH::getHashTable());
		}
	protected:
		/// Synchronizacia je nutna pretoze pre kazdu najdeny matchujuci zazname
		/// sa zasahuje do hashmapy.
		virtual bool synchronize() const  override { return true; };

	};
} // namespace jm4bbx
#endif
